﻿#ifndef MYLABEL_H
#define MYLABEL_H

#include <QApplication>
#include <QWidget>
#include <QLabel>
#include <QObject>
#include <QEvent>
#include <QMouseEvent>
#include <QPainter>
#include <QPen>
#include <QRect>
#include <QCursor>
#include <QPixmap>
#include <QImage>

#include "tool.h"

class MyLabel : public QLabel
{
    Q_OBJECT
public:
    MyLabel(QWidget *parent = nullptr);
    ~MyLabel();

    int  zoom;
    bool isEnlarge;
    void setEnlargeEnable(bool en);

private:
    QPoint startPoint;
    QPoint endPoint;
    bool isLeftMousePressMove = false;

    Qt::CursorShape getCursor(int pos);

protected:
//    void paintEvent(QPaintEvent *event) override;
    void mousePressEvent(QMouseEvent *event) override;
    void mouseReleaseEvent(QMouseEvent *event) override;
    void mouseMoveEvent(QMouseEvent *event) override;
    void wheelEvent(QWheelEvent *event) override;
    void mouseDoubleClickEvent(QMouseEvent *event) override;

signals:
    void imageDoubleClicked(void);
    void imageZoom(int);
    void cursorMovePos(QPoint);
    void imageMove(int x,int y);
};

#endif // MYLABEL_H
